package com.tripspins.app.bo;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.android.gms.maps.model.LatLng;

import java.util.ArrayList;
import java.util.List;

public class Route implements Parcelable {
	/**
	 * 
	 */
	private String name;
	private final List<LatLng> points;
	private final List<LatLng> bounds;
	private List<Segment> segments;
	private String copyright;
	private String warning;
	private String country;
	private int length;
	private String polyline;

	public Route() {
		points = new ArrayList<LatLng>();
		segments = new ArrayList<Segment>();
		bounds = new ArrayList<LatLng>();
	}
    public List<LatLng> getBounds() {
        return bounds;
    }
	public void addBound(final LatLng p) {
		bounds.add(p);
	}

	public void addPoint(final LatLng p) {
		points.add(p);
	}

	public void addPoints(final List<LatLng> points) {
		this.points.addAll(points);
	}

	public List<LatLng> getPoints() {
		return points;
	}

	public void addSegment(final Segment s) {
		segments.add(s);
	}

	public List<Segment> getSegments() {
		return segments;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(final String name) {
		this.name = name;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param copyright
	 *            the copyright to set
	 */
	public void setCopyright(String copyright) {
		this.copyright = copyright;
	}

	/**
	 * @return the copyright
	 */
	public String getCopyright() {
		return copyright;
	}

	/**
	 * @param warning
	 *            the warning to set
	 */
	public void setWarning(String warning) {
		this.warning = warning;
	}

	/**
	 * @return the warning
	 */
	public String getWarning() {
		return warning;
	}

	/**
	 * @param country
	 *            the country to set
	 */
	public void setCountry(String country) {
		this.country = country;
	}

	/**
	 * @return the country
	 */
	public String getCountry() {
		return country;
	}

	/**
	 * @param length
	 *            the length to set
	 */
	public void setLength(int length) {
		this.length = length;
	}

	/**
	 * @return the length
	 */
	public int getLength() {
		return length;
	}

	/**
	 * @param polyline
	 *            the polyline to set
	 */
	public void setPolyline(String polyline) {
		this.polyline = polyline;
	}

	/**
	 * @return the polyline
	 */
	public String getPolyline() {
		return polyline;
	}

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(name);
        parcel.writeString(copyright);
        parcel.writeString(warning);
        parcel.writeString(country);
        parcel.writeString(polyline);
        parcel.writeTypedList(points);
        parcel.writeTypedList(bounds);
        parcel.writeTypedList(segments);
        parcel.writeInt(length);
    }
    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
        public Route createFromParcel(Parcel parcel) {
            return new Route(parcel);
        }

        public Route[] newArray(int size) {
            return new Route[size];
        }
    };

    private Route(Parcel parcel)
    {
        name = parcel.readString();
        copyright = parcel.readString();
        warning = parcel.readString();
        country = parcel.readString();
        polyline = parcel.readString();
        points = new ArrayList<LatLng>();
        parcel.readTypedList(points,LatLng.CREATOR);
        bounds = new ArrayList<LatLng>();
        parcel.readTypedList(bounds,LatLng.CREATOR);
        segments = new ArrayList<Segment>();
        parcel.readTypedList(segments,Segment.CREATOR);
    }

}
